<template>
  <div id="app">
    <header>
      <i-nav v-if="key_index" :key_index.sync="key_index"></i-nav>
      <Search v-if="key_index=='1'"></Search>
    </header>
    <main class="margin-top-x">
      <router-view />
    </main>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data() {
      return {
        key_index: null,
      }
    },
    watch: {
      key_index: function() {
        console.log(this.key_index)
      }
    },
    mounted() {
      console.log(window.location.href, this.$route.path)
      switch (this.$route.path) {
        case '/server':
          this.key_index = "3"
          break;
        case '/room':
          this.key_index = "2"
          break;
        case '/':
          this.key_index = "1"
          break;
      }
    },
    methods: {}
  }
</script>

<style>
  #app {}

  header {
    min-width: 1440px;
  }

  main {
    width: 1100px;
    margin: 0 auto;
    margin-top: 1rem;
  }

  .reco {
    width: 300px;
  }

  .news {
    margin-left: 1rem;
    width: 100%;
  }

  .login-set {
    border-bottom: #f37b1d 1px solid;
  }
  .cell{
    text-align: center !important;
  }
</style>
